home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / gas_251.zip / bin_251 / bfd / archures.c < prev    next >
C/C++ Source or Header  |  1994-10-13  |  17KB  |  749 lines

  1. /* BFD library support routines for architectures.
  2.    Copyright (C) 1990, 91, 92, 93, 94 Free Software Foundation, Inc.
  3.    Hacked by John Gilmore and Steve Chamberlain of Cygnus Support.
  4.  
  5. This file is part of BFD, the Binary File Descriptor library.
  6.  
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or
  10. (at your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program; if not, write to the Free Software
  19. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  20.  
  21. /*
  22.  
  23. SECTION
  24.     Architectures
  25.  
  26.     BFD keeps one atom in a BFD describing the
  27.     architecture of the data attached to the BFD: a pointer to a
  28.     <<bfd_arch_info_type>>.  
  29.  
  30.     Pointers to structures can be requested independently of a BFD
  31.     so that an architecture's information can be interrogated
  32.     without access to an open BFD.
  33.  
  34.     The architecture information is provided by each architecture package.
  35.     The set of default architectures is selected by the macro
  36.     <<SELECT_ARCHITECTURES>>.  This is normally set up in the
  37.     @file{config/@var{target}.mt} file of your choice.  If the name is not
  38.     defined, then all the architectures supported are included. 
  39.  
  40.     When BFD starts up, all the architectures are called with an
  41.     initialize method.  It is up to the architecture back end to
  42.     insert as many items into the list of architectures as it wants to;
  43.     generally this would be one for each machine and one for the
  44.     default case (an item with a machine field of 0). 
  45.  
  46.     BFD's idea of an architecture is implemented in    @file{archures.c}.
  47. */
  48.  
  49. /*
  50.  
  51. SUBSECTION
  52.     bfd_architecture
  53.  
  54. DESCRIPTION
  55.     This enum gives the object file's CPU architecture, in a
  56.     global sense---i.e., what processor family does it belong to?
  57.     Another field indicates which processor within
  58.     the family is in use.  The machine gives a number which
  59.     distinguishes different versions of the architecture,
  60.     containing, for example, 2 and 3 for Intel i960 KA and i960 KB,
  61.     and 68020 and 68030 for Motorola 68020 and 68030. 
  62.  
  63. .enum bfd_architecture 
  64. .{
  65. .  bfd_arch_unknown,   {* File arch not known *}
  66. .  bfd_arch_obscure,   {* Arch known, not one of these *}
  67. .  bfd_arch_m68k,      {* Motorola 68xxx *}
  68. .  bfd_arch_vax,       {* DEC Vax *}   
  69. .  bfd_arch_i960,      {* Intel 960 *}
  70. .    {* The order of the following is important.
  71. .       lower number indicates a machine type that 
  72. .       only accepts a subset of the instructions
  73. .       available to machines with higher numbers.
  74. .       The exception is the "ca", which is
  75. .       incompatible with all other machines except 
  76. .       "core". *}
  77. .
  78. .#define bfd_mach_i960_core      1
  79. .#define bfd_mach_i960_ka_sa     2
  80. .#define bfd_mach_i960_kb_sb     3
  81. .#define bfd_mach_i960_mc        4
  82. .#define bfd_mach_i960_xa        5
  83. .#define bfd_mach_i960_ca        6
  84. .
  85. .  bfd_arch_a29k,      {* AMD 29000 *}
  86. .  bfd_arch_sparc,     {* SPARC *}
  87. .  bfd_arch_mips,      {* MIPS Rxxxx *}
  88. .  bfd_arch_i386,      {* Intel 386 *}
  89. .  bfd_arch_we32k,     {* AT&T WE32xxx *}
  90. .  bfd_arch_tahoe,     {* CCI/Harris Tahoe *}
  91. .  bfd_arch_i860,      {* Intel 860 *}
  92. .  bfd_arch_romp,      {* IBM ROMP PC/RT *}
  93. .  bfd_arch_alliant,   {* Alliant *}
  94. .  bfd_arch_convex,    {* Convex *}
  95. .  bfd_arch_m88k,      {* Motorola 88xxx *}
  96. .  bfd_arch_pyramid,   {* Pyramid Technology *}
  97. .  bfd_arch_h8300,     {* Hitachi H8/300 *}
  98. .#define bfd_mach_h8300   1
  99. .#define bfd_mach_h8300h  2
  100. .  bfd_arch_powerpc,   {* PowerPC *}
  101. .  bfd_arch_rs6000,    {* IBM RS/6000 *}
  102. .  bfd_arch_hppa,      {* HP PA RISC *}
  103. .  bfd_arch_z8k,       {* Zilog Z8000 *}
  104. .#define bfd_mach_z8001        1
  105. .#define bfd_mach_z8002        2
  106. .  bfd_arch_h8500,     {* Hitachi H8/500 *}
  107. .  bfd_arch_sh,        {* Hitachi SH *}
  108. .  bfd_arch_alpha,     {* Dec Alpha *}
  109. .  bfd_arch_arm,       {* Advanced Risc Machines ARM *}
  110. .  bfd_arch_ns32k,     {* National Semiconductors ns32000 *}
  111. .  bfd_arch_last
  112. .  };
  113.  
  114.  
  115. */
  116.  
  117. #include "bfd.h"
  118. #include "sysdep.h"
  119. #include "libbfd.h"
  120.  
  121. /*
  122.  
  123. SUBSECTION
  124.     bfd_arch_info
  125.  
  126. DESCRIPTION
  127.     This structure contains information on architectures for use
  128.     within BFD.
  129.  
  130. .
  131. .typedef struct bfd_arch_info 
  132. .{
  133. .  int bits_per_word;
  134. .  int bits_per_address;
  135. .  int bits_per_byte;
  136. .  enum bfd_architecture arch;
  137. .  long mach;
  138. .  char *arch_name;
  139. .  CONST  char *printable_name;
  140. .  unsigned int section_align_power;
  141. . {* true if this is the default machine for the architecture *}
  142. .  boolean the_default;    
  143. .  CONST struct bfd_arch_info * (*compatible)
  144. .    PARAMS ((CONST struct bfd_arch_info *a,
  145. .             CONST struct bfd_arch_info *b));
  146. .
  147. .  boolean (*scan) PARAMS ((CONST struct bfd_arch_info *, CONST char *));
  148. .  {* How to disassemble an instruction, producing a printable
  149. .     representation on a specified stdio stream.  This isn't
  150. .     defined for most processors at present, because of the size
  151. .     of the additional tables it would drag in, and because gdb
  152. .     wants to use a different interface.  *}
  153. .  unsigned int (*disassemble) PARAMS ((bfd_vma addr, CONST char *data,
  154. .                        PTR stream));
  155. .
  156. .  struct bfd_arch_info *next;
  157. .} bfd_arch_info_type;
  158. */
  159.  
  160. bfd_arch_info_type   *bfd_arch_info_list;
  161.  
  162.  
  163. /*
  164. FUNCTION
  165.     bfd_printable_name
  166.  
  167. SYNOPSIS
  168.     CONST char *bfd_printable_name(bfd *abfd);
  169.  
  170. DESCRIPTION
  171.     Return a printable string representing the architecture and machine
  172.     from the pointer to the architecture info structure.
  173.  
  174. */
  175.  
  176. CONST char *
  177. bfd_printable_name (abfd)
  178.      bfd *abfd;
  179. {
  180.   return abfd->arch_info->printable_name;
  181. }
  182.  
  183.  
  184.  
  185. /*
  186. FUNCTION
  187.     bfd_scan_arch
  188.  
  189. SYNOPSIS
  190.     bfd_arch_info_type *bfd_scan_arch(CONST char *string);
  191.  
  192. DESCRIPTION
  193.     Figure out if BFD supports any cpu which could be described with
  194.     the name @var{string}.  Return a pointer to an <<arch_info>>
  195.     structure if a machine is found, otherwise NULL.
  196.  
  197. */
  198.  
  199. bfd_arch_info_type *
  200. bfd_scan_arch (string)
  201.      CONST char *string;
  202. {
  203.   struct bfd_arch_info *ap;
  204.  
  205.   /* Look through all the installed architectures */
  206.   for (ap = bfd_arch_info_list;
  207.        ap != (bfd_arch_info_type *)NULL;
  208.        ap = ap->next) {
  209.  
  210.     if (ap->scan(ap, string)) 
  211.       return ap;
  212.   }
  213.   return (bfd_arch_info_type *)NULL;
  214. }
  215.  
  216.  
  217.  
  218. /*
  219. FUNCTION
  220.     bfd_arch_get_compatible
  221.  
  222. SYNOPSIS
  223.     CONST bfd_arch_info_type *bfd_arch_get_compatible(
  224.         CONST bfd *abfd,
  225.             CONST bfd *bbfd);
  226.  
  227. DESCRIPTION
  228.     Determine whether two BFDs'
  229.     architectures and machine types are compatible.  Calculates
  230.     the lowest common denominator between the two architectures
  231.     and machine types implied by the BFDs and returns a pointer to
  232.     an <<arch_info>> structure describing the compatible machine.
  233. */
  234.  
  235. CONST bfd_arch_info_type *
  236. bfd_arch_get_compatible (abfd, bbfd)
  237.      CONST bfd *abfd;
  238.      CONST bfd *bbfd;
  239. {
  240.   return  abfd->arch_info->compatible(abfd->arch_info,bbfd->arch_info);
  241. }
  242.  
  243.  
  244. /*
  245. INTERNAL_DEFINITION
  246.     bfd_default_arch_struct
  247.  
  248. DESCRIPTION
  249.     The <<bfd_default_arch_struct>> is an item of
  250.     <<bfd_arch_info_type>> which has been initialized to a fairly
  251.     generic state.  A BFD starts life by pointing to this
  252.     structure, until the correct back end has determined the real
  253.     architecture of the file.
  254.  
  255. .extern bfd_arch_info_type bfd_default_arch_struct;
  256.  
  257. */
  258.  
  259. bfd_arch_info_type bfd_default_arch_struct =
  260. {
  261.     32,32,8,bfd_arch_unknown,0,"unknown","unknown",2,true,
  262.     bfd_default_compatible,
  263.     bfd_default_scan, 
  264.     0,
  265. };
  266.  
  267. /*
  268. FUNCTION
  269.     bfd_set_arch_info
  270.  
  271. SYNOPSIS
  272.     void bfd_set_arch_info(bfd *abfd, bfd_arch_info_type *arg);
  273.  
  274. DESCRIPTION
  275.     Set the architecture info of @var{abfd} to @var{arg}.
  276. */
  277.  
  278. void
  279. bfd_set_arch_info (abfd, arg)
  280.      bfd *abfd;
  281.      bfd_arch_info_type *arg;
  282. {
  283.   abfd->arch_info = arg;
  284. }
  285.  
  286. /*
  287. INTERNAL_FUNCTION
  288.     bfd_default_set_arch_mach
  289.  
  290. SYNOPSIS
  291.     boolean bfd_default_set_arch_mach(bfd *abfd,
  292.         enum bfd_architecture arch,
  293.         unsigned long mach);
  294.  
  295. DESCRIPTION
  296.     Set the architecture and machine type in BFD @var{abfd}
  297.     to @var{arch} and @var{mach}.  Find the correct
  298.     pointer to a structure and insert it into the <<arch_info>>
  299.     pointer. 
  300. */
  301.  
  302. boolean
  303. bfd_default_set_arch_mach (abfd, arch, mach)
  304.      bfd *abfd;
  305.      enum bfd_architecture arch;
  306.      unsigned    long mach;
  307. {
  308.   static struct bfd_arch_info *old_ptr = &bfd_default_arch_struct;
  309.   boolean found = false;
  310.   /* run through the table to find the one we want, we keep a little
  311.      cache to speed things up */
  312.   if (old_ptr == 0 || arch != old_ptr->arch || mach != old_ptr->mach) {
  313.     bfd_arch_info_type *ptr;
  314.     old_ptr = (bfd_arch_info_type *)NULL;
  315.     for (ptr = bfd_arch_info_list;
  316.      ptr != (bfd_arch_info_type *)NULL;
  317.      ptr= ptr->next) {
  318.       if (ptr->arch == arch &&
  319.       ((ptr->mach == mach) || (ptr->the_default && mach == 0))) {
  320.     old_ptr = ptr;
  321.     found = true;
  322.     break;
  323.       }
  324.     }
  325.     if (found==false) {
  326.       /*looked for it and it wasn't there, so put in the default */
  327.       old_ptr = &bfd_default_arch_struct;
  328.       bfd_set_error (bfd_error_bad_value);
  329.     }
  330.   }
  331.   else {
  332.     /* it was in the cache */
  333.     found = true;
  334.   }
  335.  
  336.   abfd->arch_info = old_ptr;
  337.  
  338.   return found;
  339. }
  340.  
  341.  
  342. /*
  343. FUNCTION
  344.     bfd_get_arch
  345.  
  346. SYNOPSIS
  347.     enum bfd_architecture bfd_get_arch(bfd *abfd);
  348.  
  349. DESCRIPTION
  350.     Return the enumerated type which describes the BFD @var{abfd}'s
  351.     architecture.
  352.  
  353. */
  354.  
  355. enum bfd_architecture
  356. bfd_get_arch (abfd)
  357.      bfd *abfd;
  358. {
  359.     return abfd->arch_info->arch;
  360. }
  361.  
  362. /*
  363. FUNCTION
  364.     bfd_get_mach
  365.  
  366. SYNOPSIS
  367.     unsigned long bfd_get_mach(bfd *abfd);
  368.  
  369. DESCRIPTION
  370.     Return the long type which describes the BFD @var{abfd}'s
  371.     machine.
  372. */
  373.  
  374. unsigned long  
  375. bfd_get_mach (abfd)
  376.      bfd *abfd;
  377. {
  378.     return abfd->arch_info->mach;
  379. }
  380.  
  381. /*
  382. FUNCTION
  383.     bfd_arch_bits_per_byte
  384.  
  385. SYNOPSIS
  386.     unsigned int bfd_arch_bits_per_byte(bfd *abfd);
  387.  
  388. DESCRIPTION
  389.     Return the number of bits in one of the BFD @var{abfd}'s
  390.     architecture's bytes.
  391.  
  392. */
  393.  
  394. unsigned int
  395. bfd_arch_bits_per_byte (abfd)
  396.      bfd *abfd;
  397. {
  398.   return abfd->arch_info->bits_per_byte;
  399. }
  400.  
  401. /*
  402. FUNCTION
  403.     bfd_arch_bits_per_address
  404.  
  405. SYNOPSIS
  406.     unsigned int bfd_arch_bits_per_address(bfd *abfd);
  407.  
  408. DESCRIPTION
  409.     Return the number of bits in one of the BFD @var{abfd}'s
  410.     architecture's addresses.
  411. */
  412.  
  413. unsigned int
  414. bfd_arch_bits_per_address (abfd)
  415.      bfd *abfd;
  416. {
  417.   return abfd->arch_info->bits_per_address;
  418. }
  419.  
  420.  
  421. extern void bfd_a29k_arch PARAMS ((void));
  422. extern void bfd_alpha_arch PARAMS ((void));
  423. extern void bfd_arm_arch PARAMS ((void));
  424. extern void bfd_h8300_arch PARAMS ((void));
  425. extern void bfd_h8500_arch PARAMS ((void));
  426. extern void bfd_hppa_arch PARAMS ((void));
  427. extern void bfd_i386_arch PARAMS ((void));
  428. extern void bfd_i960_arch PARAMS ((void));
  429. extern void bfd_m68k_arch PARAMS ((void));
  430. extern void bfd_m88k_arch PARAMS ((void));
  431. extern void bfd_mips_arch PARAMS ((void));
  432. extern void bfd_powerpc_arch PARAMS ((void));
  433. extern void bfd_rs6000_arch PARAMS ((void));
  434. extern void bfd_sh_arch PARAMS ((void));
  435. extern void bfd_sparc_arch PARAMS ((void));
  436. extern void bfd_vax_arch PARAMS ((void));
  437. extern void bfd_we32k_arch PARAMS ((void));
  438. extern void bfd_z8k_arch PARAMS ((void));
  439. extern void bfd_ns32k_arch PARAMS ((void));
  440.  
  441. static void (*archures_init_table[]) PARAMS ((void)) = 
  442. {
  443. #ifdef SELECT_ARCHITECTURES
  444.   SELECT_ARCHITECTURES,
  445. #else
  446.   bfd_a29k_arch,
  447.   bfd_alpha_arch,
  448.   bfd_arm_arch,
  449.   bfd_h8300_arch,
  450.   bfd_h8500_arch,
  451.   bfd_hppa_arch,
  452.   bfd_i386_arch,
  453.   bfd_i960_arch,
  454.   bfd_m68k_arch,
  455.   bfd_m88k_arch,
  456.   bfd_mips_arch,
  457.   bfd_powerpc_arch,
  458.   bfd_rs6000_arch,
  459.   bfd_sh_arch,
  460.   bfd_sparc_arch,
  461.   bfd_vax_arch,
  462.   bfd_we32k_arch,
  463.   bfd_z8k_arch,
  464.   bfd_ns32k_arch,
  465. #endif
  466.   0
  467.   };
  468.  
  469.  
  470.  
  471. /*
  472. INTERNAL_FUNCTION 
  473.     bfd_arch_init
  474.  
  475. SYNOPSIS
  476.     void bfd_arch_init(void);
  477.  
  478. DESCRIPTION
  479.     Initialize the architecture dispatch table by
  480.     calling all installed architecture packages and getting them
  481.     to poke around.
  482. */
  483.  
  484. void
  485. bfd_arch_init ()
  486. {
  487.     void (**ptable) PARAMS ((void));
  488.     for (ptable = archures_init_table; 
  489.      *ptable ;
  490.      ptable++)
  491.     {
  492.     (*ptable)();
  493.     }
  494. }
  495.  
  496.  
  497. /*
  498. INTERNAL_FUNCTION
  499.     bfd_arch_linkin
  500.  
  501. SYNOPSIS
  502.     void bfd_arch_linkin(bfd_arch_info_type *ptr);
  503.  
  504. DESCRIPTION
  505.     Link the architecture info structure @var{ptr} into the list.
  506. */
  507.  
  508. void
  509. bfd_arch_linkin (ptr)
  510.      bfd_arch_info_type *ptr;
  511. {
  512.   ptr->next = bfd_arch_info_list;
  513.   bfd_arch_info_list = ptr;
  514. }
  515.  
  516.  
  517. /*
  518. INTERNAL_FUNCTION 
  519.     bfd_default_compatible
  520.  
  521. SYNOPSIS
  522.     CONST bfd_arch_info_type *bfd_default_compatible
  523.     (CONST bfd_arch_info_type *a,
  524.     CONST bfd_arch_info_type *b);
  525.  
  526. DESCRIPTION
  527.     The default function for testing for compatibility.
  528. */
  529.  
  530. CONST bfd_arch_info_type *
  531. bfd_default_compatible (a,b)
  532.      CONST bfd_arch_info_type *a;
  533.      CONST bfd_arch_info_type *b;
  534. {
  535.   if(a->arch != b->arch) return NULL;
  536.  
  537.   if (a->mach > b->mach) {
  538.     return a;
  539.   }
  540.   if (b->mach > a->mach) {
  541.     return b;
  542.   }
  543.   return a;
  544. }
  545.  
  546.  
  547. /*
  548. INTERNAL_FUNCTION
  549.     bfd_default_scan
  550.  
  551. SYNOPSIS
  552.     boolean bfd_default_scan(CONST struct bfd_arch_info *info, CONST char *string);
  553.  
  554. DESCRIPTION
  555.     The default function for working out whether this is an
  556.     architecture hit and a machine hit.
  557. */
  558.  
  559. boolean 
  560. bfd_default_scan (info, string)
  561.      CONST struct bfd_arch_info *info;
  562.      CONST char *string;
  563. {
  564.     CONST  char *ptr_src;
  565.     CONST   char *ptr_tst;
  566.     unsigned long number;
  567.     enum bfd_architecture arch;
  568.     /* First test for an exact match */
  569.     if (strcmp(string, info->printable_name) == 0) return true;
  570.  
  571.     /* See how much of the supplied string matches with the
  572.        architecture, eg the string m68k:68020 would match the 68k entry
  573.        up to the :, then we get left with the machine number */
  574.  
  575.     for (ptr_src = string,
  576.      ptr_tst = info->arch_name; 
  577.      *ptr_src && *ptr_tst;
  578.      ptr_src++,
  579.      ptr_tst++) 
  580.     {
  581.     if (*ptr_src != *ptr_tst) break;
  582.     }
  583.  
  584.     /* Chewed up as much of the architecture as will match, skip any
  585.        colons */
  586.     if (*ptr_src == ':') ptr_src++;
  587.   
  588.     if (*ptr_src == 0) {
  589.         /* nothing more, then only keep this one if it is the default
  590.            machine for this architecture */
  591.         return info->the_default;
  592.     }
  593.     number = 0;
  594.     while (isdigit(*ptr_src)) {
  595.         number = number * 10 + *ptr_src  - '0';
  596.         ptr_src++;
  597.     }
  598.  
  599.     switch (number) 
  600.     {
  601.      case 300:
  602.       arch = bfd_arch_h8300;
  603.       break;
  604.  
  605.      case 500:
  606.       arch = bfd_arch_h8500;
  607.       break;
  608.  
  609.       case 68010:
  610.       case 68020:
  611.       case 68030:
  612.       case 68040:
  613.       case 68332:
  614.       case 68050:        
  615.       case 68000: 
  616.     arch = bfd_arch_m68k; 
  617.     break;
  618.       case 386: 
  619.       case 80386:
  620.       case 486:
  621.       case 80486:
  622.     arch = bfd_arch_i386;
  623.     break;
  624.       case 29000: 
  625.     arch = bfd_arch_a29k;
  626.     break;
  627.  
  628.        case 8000:
  629.     arch = bfd_arch_z8k;
  630.     break;
  631.  
  632.       case 32000:
  633.     arch = bfd_arch_we32k;
  634.     break;
  635.  
  636.       case 860:
  637.       case 80860: 
  638.     arch = bfd_arch_i860; 
  639.     break;
  640.       case 960:
  641.       case 80960:
  642.     arch = bfd_arch_i960;
  643.     break;
  644.  
  645.       case 2000:
  646.       case 3000:
  647.       case 4000:
  648.       case 4400:
  649.         arch = bfd_arch_mips;
  650.         break;
  651.  
  652.       case 6000:
  653.     arch = bfd_arch_rs6000;
  654.     break;
  655.  
  656.       default:  
  657.     return false;
  658.     }
  659.     if (arch != info->arch) 
  660.      return false;
  661.  
  662.     if (number != info->mach)
  663.      return false;
  664.  
  665.     return true;
  666. }
  667.  
  668.  
  669. /*
  670. FUNCTION
  671.     bfd_get_arch_info
  672.  
  673. SYNOPSIS
  674.     bfd_arch_info_type * bfd_get_arch_info(bfd *abfd);
  675.  
  676. DESCRIPTION
  677.     Return the architecture info struct in @var{abfd}.
  678. */
  679.  
  680. bfd_arch_info_type *
  681. bfd_get_arch_info (abfd)
  682.      bfd *abfd;
  683. {
  684.   return  abfd->arch_info;
  685. }
  686.  
  687.  
  688. /*
  689. FUNCTION
  690.     bfd_lookup_arch
  691.  
  692. SYNOPSIS
  693.     bfd_arch_info_type *bfd_lookup_arch
  694.         (enum bfd_architecture
  695.         arch,
  696.         long machine);
  697.  
  698. DESCRIPTION
  699.     Look for the architecure info structure which matches the
  700.     arguments @var{arch} and @var{machine}. A machine of 0 matches the
  701.     machine/architecture structure which marks itself as the
  702.     default.
  703. */
  704.  
  705. bfd_arch_info_type * 
  706. bfd_lookup_arch (arch, machine)
  707.      enum bfd_architecture arch;
  708.      long machine;
  709. {
  710.     bfd_arch_info_type *ap;
  711.     bfd_check_init();  
  712.     for (ap = bfd_arch_info_list; 
  713.      ap !=  (bfd_arch_info_type *)NULL;
  714.      ap = ap->next) {
  715.         if (ap->arch == arch &&
  716.         ((ap->mach == machine) 
  717.          || (ap->the_default && machine == 0))) {
  718.             return ap;
  719.         }
  720.     }
  721.     return (bfd_arch_info_type *)NULL;
  722. }
  723.  
  724.  
  725. /*
  726. FUNCTION
  727.     bfd_printable_arch_mach
  728.  
  729. SYNOPSIS
  730.     CONST char *bfd_printable_arch_mach
  731.         (enum bfd_architecture arch, unsigned long machine);
  732.  
  733. DESCRIPTION
  734.     Return a printable string representing the architecture and
  735.     machine type. 
  736.  
  737.     This routine is depreciated.
  738. */
  739.  
  740. CONST char *
  741. bfd_printable_arch_mach (arch, machine)
  742.      enum bfd_architecture arch;
  743.      unsigned long machine;
  744. {
  745.     bfd_arch_info_type *ap = bfd_lookup_arch(arch, machine);
  746.     if(ap) return ap->printable_name;
  747.     return "UNKNOWN!";
  748. }
  749.